using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ImmediateDamageImpact : BaseImpactEffect
{
    public override void EndEffect()
    {
        throw new System.NotImplementedException();
    }

    public override void Execute(SkillDeployer baseDeployer)
    {
        throw new System.NotImplementedException();
    }

    public override void OnImpactTriggerEntry(Collider2D collision)
    {
        base.OnImpactTriggerEntry(collision);

        if(skillData.attackType == AttackType.Single)
        {
            collision.GetComponent<CharacterStats>()?.BeDamaged(skillData.damage);
        }
        if(skillData.attackType == AttackType.Aoe) 
        {
            var deployer = skillObject.GetComponent<SkillDeployer>();
            deployer.ChooseTarget();
            for(int i = 0; i < deployer.targets.Count; i++) 
            {
                deployer.targets[i].GetComponent<CharacterStats>()?.BeDamaged(skillData.damage);
            }
        }
    }
}
